﻿@{
    Layout = null;
}

<!DOCTYPE html>
@model ElingOA6_Admin_DSJCJ.Model.ChkInfoAuditManual
<html>
<head>
    <title>ChkDocHighEnrolEdit</title>
          @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    
    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>
         <script>
             if (top.boardtop) {
                 top.boardtop.head_txt.innerText = "上级录用信息录入";
                 parent.boardtop.noneChooseYear();
             }
    </script>

    @Html.DevExpress().GetStyleSheets(

                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

)
    @Html.DevExpress().GetScripts(
                    new Script { ExtensionType = ExtensionType.ListBox }
    )

    <script>
        $(document).ready(function () {
            $("#toolMenu").smartFloat();
            var hdjsAlert = $("#hdjsAlert").val();
            if (hdjsAlert != "") {
                if (hdjsAlert == "操作成功") {
                    alert(hdjsAlert);
                    window.location.href = rootPath + "/Admin/ChkDocHighEnrol/Index";
                }
                else {
                    alert(hdjsAlert);
                }
            }
        });

        function CboValueChanged() {
            var no = FInfoClsNo.GetValue();
            if (FInfoClsNo.GetValue() == "-1") {
                alert("不能选择含有子类的类别");
                FInfoClsNo.SetValue("-2");
            }
            else if (no != "-2") {
                var arr = no.split("-");
                $("#hidChkInfoNo").val(arr[0]);
                if (arr[1] == "2") {
                    FScore.SetText("0");
                    FScore.SetEnabled(true);
                }
                else {
                    FScore.SetText("计 1 篇");
                    FScore.SetEnabled(false);
                }
            }
        }

        function Load() {
            var no = FInfoClsNo.GetValue();
            if (no != "-2") {
                var arr = no.split("-");
                $("#hidChkInfoNo").val(arr[0]);
                if (arr[1] == "2") {
                    FScore.SetEnabled(true);
                }
                else {
                    FScore.SetText("计 1 篇");
                    FScore.SetEnabled(false);
                }
            }
        }

        function OK() {
            if (FInfoClsNo.GetValue() == "-2") {
                alert("上级录用类别必须选择");
                return;
            }
            if (FDeptName.GetValue() == "") {
                alert("部门必须选择");
                return;
            }

            if (FTitle.GetValue() == "") {
                alert("标题必须填写");
                return;
            }
            if (FScore.GetValue() != "计 1 篇") {
                if (!isNaN(FScore.GetValue())) {
                } else {
                    alert("录用得分必须是数字");
                    return;
                }
            }

            form1.submit();
        }

//            function clearNoNum(obj) {
//                //先把非数字的都替换掉，除了数字和.
//                obj.value = obj.value.replace(/[^\d.]/g, "");
//                //必须保证第一个为数字而不是.
//                obj.value = obj.value.replace(/^\./g, "");
//                //保证只有出现一个.而没有多个.
//                obj.value = obj.value.replace(/\.{2,}/g, ".");
//                //保证.只出现一次，而不能出现两次以上
//                obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
//            }

        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnSave":
                    {
                        //保存
                        OK();
                        break;
                    }
                case "btnCancel":
                    {
                        window.location.href = rootPath + "/Admin/ChkDocHighEnrol/Index";
                        break;
                    }
            }
        }

        function ButtonClick() {
            var url = rootPath + "/Admin/Dialog/ChkDocHighEnrolEmpTree";
            var rs = window.showModalDialog(url, "ChkInfoClsTree", "dialogWidth:300px;dialogHeight:500px");
            if (rs != "[]" && typeof (rs) != "undefined") {
                var List = JSON.parse(rs);
                $.ajax({
                    type: "POST",
                    url: rootPath + "/Admin/ChkDocHighEnrol/GetEmp",
                    data: { empid: List[0].Value },
                    async: true,
                    success: function (jsonstr) {
                        if (jsonstr != "") {
                            var List = JSON.parse(jsonstr);
                            $("#hddeptno").val(List.FDeptNo);
                            $("#hdempno").val(List.FEmplNo);
                            FDeptName.SetText(List.FDeptName);
                            FEmpName.SetText(List.FEmpName);
                        }
                    }
                });
            }
        }
    </script>
</head>
<body>
@using (Html.BeginForm("Save", "ChkDocHighEnrol", FormMethod.Post, new { id = "form1" }))
{
     <div class="floatToolMenu" id="toolMenu">
        @Html.DevExpress().Menu(settings =>
   {
       settings.Name = "toolBarMenu";
       settings.ItemAutoWidth = false;
       settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
       settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
       settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);
       settings.Items.Add(item =>
       {
           item.Name = "btnSave";
           item.Text = "保存";
           item.ClientEnabled = true;
           item.Image.Url = Url.Content("~/Content/ControlImages/filesave.png");

       });
       settings.Items.Add(item =>
       {
           item.Name = "btnCancel";
           item.Text = "取消";
           item.ClientEnabled = true;
           item.Image.Url = Url.Content("~/Content/ControlImages/no.png");

       });
       settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
       settings.ItemLinkMode = ItemLinkMode.ContentBounds;
   }).GetHtml()
   </div>
    <div>
          <table align="center" class="tableForm">
            <tr>
                <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "标题:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass" colspan="3">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FTitle";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.FTitle;

               }).GetHtml()
                </td>
               
            </tr>
                        <tr>
                <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "部门:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass">
               @Html.DevExpress().ButtonEdit(settings =>
               {
                   settings.Name = "FDeptName";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.FDeptName;
                   settings.ReadOnly = true;
                   settings.Properties.Buttons.Add("选择");
                   settings.Properties.ClientSideEvents.ButtonClick = "ButtonClick";
               }).GetHtml()


                </td>
                             <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "作者:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FEmpName";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.FEmpName;
                   settings.ReadOnly = true;
               }).GetHtml()
                </td>
            </tr>
               <tr>
                <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "上级录用栏目:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass">
                    @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "FInfoClsNo";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Properties.TextField = "Text";
                   settings.Properties.ValueField = "Value";
                   settings.Properties.EnableAnimation = false;
                   settings.Properties.ClientSideEvents.Init = "Load";
                   settings.Properties.ClientSideEvents.ValueChanged = "CboValueChanged";
               }).BindList(ViewData["SelectListItem"] as List<SelectListItem>).Bind(Model.FInfoClsNo).GetHtml()
                </td>
                                <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "录用得分:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FScore";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.FScore.ToString();
               }).GetHtml()
                </td>
            </tr>

            <tr>
                <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "刊登媒体:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FInfoMedia";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.FInfoMedia;
               }).GetHtml()
                </td>
                  <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "版面:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FPage";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.FPage;
               }).GetHtml()
                </td>
            </tr>
            <tr>
                <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "上级部门录用时间:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass">
                    @Html.DevExpress().DateEdit(settings =>
               {
                   settings.Name = "FAuditDate";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);

               }).Bind(Model.FAuditDate).GetHtml()
                </td>
                <th>
                </th>
                <th>
                </th>
            </tr>
            <tr>
                <th style="width: 15%">
                   @Html.DevExpress().Label(settings => { settings.Text = "备注:"; }).GetHtml()
                </th>
                <td style="width: 35%" class="tdClass" colspan="3">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FNote";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.FNote;
               }).GetHtml()
                </td>
            </tr>
            </table>
                    @Html.Hidden("hidYear", ViewData["year"])    
                    @Html.Hidden("hddeptno", Model.FDeptNo)    
                    @Html.Hidden("hdempno", Model.FEmpNo)    
                    @Html.Hidden("hidChkInfoNo", ViewData["FInfoClsNo"])    
                    @Html.Hidden("hidFInfoID", Model.FInfoID)   
                    @Html.Hidden("hdjsAlert", (ViewData["jsAlert"]))
                    @Html.Hidden("hdtype", ViewData["type"])     
                    
    </div>
}
</body>
</html>
